import java.util.*;

public class Main {
    public static int gcd(int a, int b) {
        while (b != 0) {
            int temp = b;
            b = a % b;
            a = temp;
        }
        return a;
    }

    public static int lcm(int a, int b) {
        return a / gcd(a, b) * b; // 防止溢出
    }
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n  = scanner.nextInt();
        long[] cache = new long[n+1];
        cache[1] = 1;
        long sum = cache[1];
        for (int i = 2; i <= n; i++) {
            cache[i] = i*cache[i-1];
            sum += cache[i];
        }
        System.out.println(sum);
    }
}
